﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RenAi.Medical.Model;
using RenAi.Medical.BLL;

namespace RenAi.Medical.Admin
{
    public partial class wenti : System.Web.UI.Page
    {
        ProblemBLL bll = new ProblemBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }
        protected void LoadData()
        {
            Repeater1.DataSource = bll.GetALLProblem();
            Repeater1.DataBind();
        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string ename = e.CommandName;
            string Proid = e.CommandArgument.ToString();
            switch(ename)
            {
                case "del":
                    if(bll.DelProblem(Proid)>0)
                    {
                        Response.Write("<script>alert('删除成功!')</script>");
                        LoadData();
                    };
                    break;
                case "add":
                    Response.Redirect("AddAnswer.aspx?id="+Proid);
                    break;
            }
        }
    }
}